<?php

namespace app\api\model;

use think\Model;
use traits\model\SoftDelete;

class CouponCategory extends Model
{
    use SoftDelete;

    protected $deleteTime = 'deletetime';

    protected $hidden = ['deletetime', 'createtime', 'updatetime', 'weigh', 'online'];

    public function getImageAttr($value)
    {
        return $value ? request()->domain().$value : '';
    }

    public static function getCategories()
    {
        return self::where('online', 1)->order('weigh desc')->select();
    }

}
